<layout name="layout"/>

<!-- 搜索 -->
<div class="form-div search_form_div">
    <form action="__ACTION__" method="GET" name="search_form">
        <p>
            用户名：
            <input type="text" name="username" size="30" value="<?php echo I('get.username'); ?>"/>
        </p>
        <p>
            手机号：
            <input type="text" name="phone" size="30" value="<?php echo I('get.phone'); ?>"/>
        </p>
        <p><input type="submit" value=" 搜索 " class="button"/></p>
    </form>
</div>
<!-- 列表 -->
<div class="list-div" id="listDiv">
    <table class="table table-hover text-center">
        <tr>
            <th>ID</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>注册时间</th>
            <th>会员类型</th>
            <th>会员过期时间</th>
            <th>所属代理编号</th>
            <th width="300">操作</th>
        </tr>
        <?php foreach ($data as $k => $v): ?>
        <tr class="tron">
            <td><?php echo $v['id']; ?></td>
            <td><?php echo $v['username']; ?></td>
            <td><?php echo $v['phone']; ?></td>
            <td><?php echo date('Y-m-d H:i:s',$v['retime']); ?></td>
            <td><?php if($v['vipid']==0){echo '大众会员' ;}else{ echo $v['vipname']; }?></td>
            <td><?php echo date('Y-m-d H:i:s',$v['viptime']);?></td>
            <td><?php if($v['domain']=='admin'){echo 'admin' ;}else{echo $v['agentname'];} ?></td>
            <td align="center">
                <a href="<?php echo U('edit?id='.$v['id'].'&p='.I('get.p')); ?>" title="编辑"
                   class="button border-main" style="cursor: pointer"><span class="icon-edit"></span>编辑</a>
                <a class="button border-red del" style="cursor: pointer"
                   url="<?php echo U('delete?id='.$v['id'].'&p='.I('get.p')); ?>"
                   title="移除" onclick="del(this)"> <span class="icon-trash-o"></span>移除</a>
            </td>
        </tr>
        <?php endforeach; ?>
        <?php if(preg_match('/\d/', $page)): ?>
        <tr>
            <td colspan="10">
                <?php echo $page; ?>
            </td>
        </tr>
        <?php endif; ?>
    </table>
</div>
<script>
    function del(obj) {
        if (confirm('确认删除吗？')) {
            $.get($(obj).attr('url'), function (res) {
                alert(res.info);
                location.href = res.url;
            })
        }
    }

</script>